#include <STC15F2K60S2.H>
#include "iic.h"
#include "Seg.h"
#include "Tim.h"
#include "stdio.h"
unsigned char pucSeg_Buf[9],pucSeg_Code[8],ucSeg_Pos;
unsigned int ucSeg_Dly;
unsigned char pucBuf[3]={2,10,22};
unsigned long ulms;
void Seg_Proc(void);
void iic_proc(void);
void main(){
	Cls_Peripheral() ;
	Timer1Init();
	iic_proc();
	while(1){
		Seg_Proc();
}
}
void Time_1(void) interrupt 3 //定时器1中断函数
{ 
	 ulms++; 
	 if(!(ulms % 1000)) 
	 { 

	} 
	 if(++ucSeg_Dly==500) ucSeg_Dly=0;
	 Seg_Disp(pucSeg_Code, ucSeg_Pos);
	if(++ucSeg_Pos==8) ucSeg_Pos=0;
}
void Seg_Proc(void){
	if(ucSeg_Dly) return;
	ucSeg_Dly=1;
	
	sprintf(pucSeg_Buf,"%02d%02d%02d",(unsigned int)pucBuf[0],(unsigned int)pucBuf[1],(unsigned int)pucBuf[2]);
	Seg_Tran(pucSeg_Buf, pucSeg_Code);
}
void iic_proc(void){
	
	//EEPROM_Write(pucBuf,1, 3);
	EEPROM_Read(pucBuf, 1, 3);
}
